using System.Collections.Generic;

namespace OpenWaves.Web.Controls
{
    public class NavigationNode : INavigationNode
    {
        private readonly RelativeUrl url;
        private readonly string name;
        private readonly string description;
        private readonly List<INavigationNode> children = new List<INavigationNode>();
        private readonly bool isVisibleInMenu;

        public Url Url
        {
            get { return this.url; }
        }

        public string Name
        {
            get { return name; }
        }

        public string Description
        {
            get { return description; }
        }

        public IEnumerable<INavigationNode> Children
        {
            get { return this.children; }
        }

        public bool IsVisibleInMenu
        {
            get { return this.isVisibleInMenu; }
        }

        public NavigationNode(RelativeUrl url, string name, string description, params INavigationNode[] children)
            : this(url, name, description, true, children)
        { }

        public NavigationNode(RelativeUrl url, string name, string description, bool isVisibleInMenu, params INavigationNode[] children)
        {
            this.url = url;
            this.name = name;
            this.description = description;
            this.children.AddRange(children);
            this.isVisibleInMenu = isVisibleInMenu;
        }
    }
}